/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package de.swta;

import org.apache.wicket.Component;
import org.apache.wicket.ajax.AjaxRequestTarget;
import org.apache.wicket.markup.html.basic.Label;
import org.apache.wicket.markup.html.panel.FeedbackPanel;
import org.apache.wicket.markup.html.panel.Panel;

public abstract class ItemEditContentPanel extends Panel {

    String itemId;
    ItemForm itemForm;

    public ItemEditContentPanel(String id, Component parent) {
        super(id);

        this.itemForm = new ItemForm("itemForm", parent);
        add(itemForm);
        add(new FeedbackPanel("feedb"));
        // Create the form, to use later for the buttons
        add(new Label("textLabel", ""));

    }

    public void setItemToEdit(String itemId) {
        this.itemId = itemId;
        this.itemForm.setModelObject(MyItemManager.getInstance().getItem(itemId));
//        this.itemForm.render();
    }
    
    public void setMessageText(String text) {
        this.remove("textLabel");
        add(new Label("textLabel", text));
    }

    abstract void onCancel(AjaxRequestTarget target);

    abstract void onSelect(AjaxRequestTarget target, String selection);

}

